home *** CD-ROM | disk | FTP | other *** search
Wrap
// Copyright (C) 1997-2002 Alias|Wavefront, // a division of Silicon Graphics Limited. // // The information in this file is provided for the exclusive use of the // licensees of Alias|Wavefront. Such users have the right to use, modify, // and incorporate this code into other products for purposes authorized // by the Alias|Wavefront license agreement, without fee. // // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. // // // Alias|Wavefront Script File // MODIFY THIS AT YOUR OWN RISK // // Creation Date: July 16, 1999 // Author: bb // // Description: // This script is the create clip option box dialogs. // // Input Arguments: // None. // // Return Value: // None. // proc setOptionVars (int $forceFactorySettings) { // Clip name // if ($forceFactorySettings || !`optionVar -exists createClipName`) { optionVar -stringValue createClipName "clip1"; } if ($forceFactorySettings || !`optionVar -exists createClipSchedule`) { optionVar -intValue createClipSchedule 1; } if ($forceFactorySettings || !`optionVar -exists createClipSubChar`) { optionVar -intValue createClipSubChar 1; } if( $forceFactorySettings || !`optionVar -exists createClipStart` ) { optionVar -floatValue createClipStart 0; } if( $forceFactorySettings || !`optionVar -exists createClipEnd` ) { optionVar -floatValue createClipEnd 10; } // createClipTimeWarp // 0: No Warp Curve Created // 1: Time Warp Curve Created // if ( $forceFactorySettings || !`optionVar -exists createClipTimeWarp`) { optionVar -intValue createClipTimeWarp 0; } // createClipRangeMethodWhich: // 1: set the clip for the selected range // 2: set the clip for the time slider range // 3: set the clip for the length of the anim curves // 4: set the clip for the specified start and end times (default) // if ( $forceFactorySettings || !`optionVar -exists createClipRangeMethodWhich`) { optionVar -intValue createClipRangeMethodWhich 3; } if ($forceFactorySettings || !`optionVar -exists clipHierarchy`) { // use hierarchy: default is true optionVar -intValue clipHierarchy 1; } } // // Procedure Name: // createClipSetup // // Description: // Update the state of the option box UI to reflect the option values. // // Input Arguments: // parent - Top level parent layout of the option box UI. // Required so that UI object names can be // successfully resolved. // // forceFactorySettings - Whether the option values should be set to // default values. // // Return Value: // None. // global proc createClipSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings. setOptionVars( $forceFactorySettings ); setParent $parent; // Set the clip name. string $name = `optionVar -query createClipName`; textFieldGrp -e -text $name clipNameWidget; // Set the schedule flag int $scheduleIt = `optionVar -query createClipSchedule`; // Set the subcharacter flag int $useSubcharacters = `optionVar -query createClipSubChar`; checkBoxGrp -edit -value1 $useSubcharacters useSubCharWidget; switch ($scheduleIt) { case 1: radioButtonGrp -e -sl 1 scheduleMethod; break; default: case 2: case 3: radioButtonGrp -e -sl 1 moveToLibraryMethod; break; } // 1 == Remove character's existing animation & add clip to track editor // 2 == Remove character's existing animation and add clip to library // 3 == Keep existing animation and add clip to library // if ($scheduleIt == 3) { checkBoxGrp -edit -value1 true leaveKeysWidget; radioButtonGrp -e -enable false scheduleMethod; } else { radioButtonGrp -e -enable true scheduleMethod; checkBoxGrp -edit -value1 false leaveKeysWidget; } // Set the start and end times. float $start = `optionVar -query createClipStart`; float $end = `optionVar -query createClipEnd`; floatFieldGrp -edit -value1 $start -enable false frameStartValue; floatFieldGrp -edit -value1 $end -enable false frameEndValue; // Set the correct radio button. int $whichMethod = `optionVar -query createClipRangeMethodWhich`; switch($whichMethod) { case 1: radioButtonGrp -e -sl 1 selectedMethod; break; case 2: radioButtonGrp -e -sl 1 timeSliderMethod; break; case 3: radioButtonGrp -e -sl 1 animCurveMethod; break; case 4: default: radioButtonGrp -e -sl 1 startEndMethod; floatFieldGrp -e -enable true frameStartValue; floatFieldGrp -e -enable true frameEndValue; break; } // Set the correct warp curve radio button. // int $whichWarp = `optionVar -query createClipTimeWarp`; checkBoxGrp -edit -value1 $whichWarp createTimeWarpGrp; checkBoxGrp -edit -value1 `optionVar -query clipHierarchy` clipHierWidget; } // // Procedure Name: // createClipCallback // // Description: // Update the option values with the current state of the option box UI. // // Input Arguments: // parent - Top level parent layout of the option box UI. Required so // that UI object names can be successfully resolved. // // doIt - Whether the command should execute. // // Return Value: // None. // global proc createClipCallback (string $parent, int $doIt) { setParent $parent; // Name // optionVar -stringValue createClipName `textFieldGrp -q -text clipNameWidget`; // Set the schedule flag int $leaveKeys = `checkBoxGrp -query -value1 leaveKeysWidget`; int $useSubChar = `checkBoxGrp -query -value1 useSubCharWidget`; optionVar -intValue createClipSubChar $useSubChar; // if the user selects leaveKeys, dim the scheduleMethod widget, since // we only allow you add add the clip to the library if you leave the // keys // if ($leaveKeys) { optionVar -intValue createClipSchedule 3; radioButtonGrp -e -enable false scheduleMethod; radioButtonGrp -e -sl 1 moveToLibraryMethod; } else { radioButtonGrp -e -enable true scheduleMethod; if (`radioButtonGrp -q -sl scheduleMethod` == 1) { optionVar -intValue createClipSchedule 1; } else if (`radioButtonGrp -q -sl moveToLibraryMethod` == 1) { optionVar -intValue createClipSchedule 2; } } if (`radioButtonGrp -q -sl selectedMethod` == 1) { optionVar -intValue createClipRangeMethodWhich 1; } else if (`radioButtonGrp -q -sl timeSliderMethod` == 1) { optionVar -intValue createClipRangeMethodWhich 2; } else if (`radioButtonGrp -q -sl animCurveMethod` == 1) { optionVar -intValue createClipRangeMethodWhich 3; } else { optionVar -intValue createClipRangeMethodWhich 4; } optionVar -floatValue createClipStart `floatFieldGrp -query -value1 frameStartValue`; optionVar -floatValue createClipEnd `floatFieldGrp -query -value1 frameEndValue`; int $warpOption = `checkBoxGrp -q -value1 createTimeWarpGrp`; optionVar -intValue createClipTimeWarp $warpOption; optionVar -intValue clipHierarchy `checkBoxGrp -q -value1 clipHierWidget`; if ($doIt) performCreateClip false; } proc string createClipWidgets( string $parent ) { setParent $parent; string $tabForm = `columnLayout -adj true`; textFieldGrp -label "Name" -text "clip1" -parent $tabForm clipNameWidget; // schedule it checkBoxGrp -label "Keys" -label1 "Leave Keys in Timeline" -annotation "Leave Keys In Timeline: Creates a clip and puts it into Visor. It leaves the keys on the timeline so that you can create another clip using the same keys." -onc "radioButtonGrp -e -enable false scheduleMethod; radioButtonGrp -e -sl 1 moveToLibraryMethod;" -ofc "radioButtonGrp -e -enable true scheduleMethod;" -numberOfCheckBoxes 1 leaveKeysWidget; // how to schedule it radioButtonGrp -numberOfRadioButtons 1 -label "Clip" -label1 "Put Clip in Visor Only" -annotation "Put Clip in Visor Only: The clip is put in the Visor for later use." moveToLibraryMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 "Put Clip in Trax Editor and Visor" -annotation "Put Clip in Trax Editor and Visor: The clip is placed in the Trax editor for immediate use. The clip is also put in the Visor for later use." -shareCollection moveToLibraryMethod scheduleMethod; // clip start & duration radioButtonGrp -numberOfRadioButtons 1 -label "Time Range" -label1 "Selected" -annotation "Selected: The clip start and end are defined by the time range selected on the time slider." selectedMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 "Time Slider" -annotation "Time Slider: The clip start and end are defined by the entire range of the time slider." -shareCollection selectedMethod timeSliderMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 "Animation Curve" -annotation "Animation Curve: The clip start and end are defined by the start and end keys of the animation curve(s) in the clip." -shareCollection selectedMethod animCurveMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 "Start/End" -annotation "Start/End: Manually enter the clip start and end in the boxes below." -select 1 -shareCollection selectedMethod -onCommand "floatFieldGrp -e -enable true frameStartValue; floatFieldGrp -e -enable true frameEndValue;" -offCommand "floatFieldGrp -e -enable false frameStartValue; floatFieldGrp -e -enable false frameEndValue;" startEndMethod; frameLayout -bv no -lv no -collapsable no startEndFrame; columnLayout -adjustableColumn true; floatFieldGrp -label "Start Time" -value1 0.0 frameStartValue; floatFieldGrp -label "End Time" -value1 10.0 frameEndValue; setParent ..; setParent ..; setParent ..; // whether to include subcharacters in the clip checkBoxGrp -label "Subcharacters" -label1 "Include Subcharacters in Clip" -annotation "Subcharacters: Whether to create clips for the subcharacters of this character." -numberOfCheckBoxes 1 useSubCharWidget; // clip time warps checkBoxGrp -label "Time Warp" -label1 "Create Time Warp Curve" -annotation "Time Warp: A time warp will be created for later use." -numberOfCheckBoxes 1 createTimeWarpGrp; separator; checkBoxGrp -label "Include" -label1 "Hierarchy" -annotation "Hierarchy: When creating the clip, all objects parented beneach the selected objects will be included." -numberOfCheckBoxes 1 clipHierWidget; return $tabForm; } global proc createClipOptions () { string $commandName = "createClip"; string $applyTitle = "Create"; // Build the option box "methods" // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // Get the option box. // // The value returned is the name of the layout to be used as // the parent for the option box UI. // string $layout = getOptionBox(); setParent $layout; setOptionBoxCommandName("clip"); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -scr true -tv false; // To get the scroll bars string $parent = `columnLayout -adjustableColumn 1`; createClipWidgets $parent; waitCursor -state 0; setUITemplate -popTemplate; // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label "Create Clip" -command ($callback + " " + $parent + " " + 1) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Set the option box title. // setOptionBoxTitle("Create Clip Options"); // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "CreateClip" ); // Set the current values of the option box. // eval (($setup + " " + $parent + " " + 0)); // Show the option box. // showOptionBox(); } // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // None. // // Return Value: // None. // proc string assembleCmd() { string $cmd; setOptionVars(false); // get the partition name string $clipName = "clip1"; if (`optionVar -exists createClipName`) { $clipName = `optionVar -query createClipName`; } int $scheduleIt = 1; if (`optionVar -exists createClipSchedule`) { $scheduleIt = `optionVar -query createClipSchedule`; } int $useSubChar = 1; if (`optionVar -exists createClipSubChar`) { $useSubChar = `optionVar -query createClipSubChar`; } string $createMethod = "startEndMethod"; int $whichMethod = `optionVar -q createClipRangeMethodWhich`; switch ($whichMethod) { case 1: $createMethod = "selectedMethod"; break; case 2: $createMethod = "timeSliderMethod"; break; case 3: $createMethod = "animCurveMethod"; break; } string $warpMethod = "noWarp"; int $timeWarp = `optionVar -q createClipTimeWarp`; if ($timeWarp > 0) { $warpMethod = "enabledWarp"; } int $useHierarchy = 0; if (`optionVar -exists clipHierarchy`) { $useHierarchy = `optionVar -query clipHierarchy`; } // doCreateClipArgList takes a string array // $cmd = "doCreateClipArgList 4 { " + "\"" + $clipName + "\"" + ",\"" + $scheduleIt + "\"" + ",\"" + $createMethod + "\"" + ",\"" + `optionVar -query createClipStart` + "\"" + ",\"" + `optionVar -query createClipEnd` + "\"" + ",\"" + $useSubChar + "\"" + ",\"" + $warpMethod + "\"" + ",\"" + $useHierarchy + "\"" + " };"; return $cmd; } // // Procedure Name: // performCreateClip // // Description: // Create a clip and add the animatable attributes from the // selected nodes. This procedure will also show the option box // window if necessary as well as construct the command string // that will create a clip with the current option box values. // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // None. // global proc string performCreateClip (int $action) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Retrieve the option settings // setOptionVars(false); // Get the command. // $cmd = `assembleCmd`; // Execute the command with the option settings. // if ($cmd != "") eval($cmd); break; // Show the option box. // case 1: createClipOptions; break; case 2: // Get the command. // $cmd = `assembleCmd`; } return $cmd; }